import java.util.Scanner;
public class Test {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个数，计算他的阶乘之和");
        int n = scanner.nextInt();
        int sum = 0;

        for (int j = 1; j <= n ; j++) {

            int ret = 1;
            for (int i = 1; i <= j; i++) {
                ret *= i;
            }
//            System.out.println(ret);
            sum += ret;

        }
        System.out.println(sum);


    }
}
